package com.musifind.activities;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;

import com.musifind.adapters.SearchAdapterArtists;
import com.musifind.models.SearchItems;

public class ArtistsFragment extends BaseFragment {

	private ListView lstSearchArtists;
	static ImageView imgLogo;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_artists, container, false);
		imgLogo = (ImageView) rootView.findViewById(R.id.imgBlankPage);
		searchAdapterArtists = new SearchAdapterArtists(getActivity(), R.layout.search_list_items_row_artist,
				searchArrayArtists);
		lstSearchArtists = (ListView) rootView.findViewById(R.id.lstSearchArtistItems);
		lstSearchArtists.setAdapter(searchAdapterArtists);

		lstSearchArtists.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				SearchItems item = (SearchItems) searchAdapterArtists.getItem(position);
				Intent i = new Intent(getActivity(), AlbumsOfArtistActivity.class);
				i.putExtra("artistId", item.getArtistId());
				i.putExtra("artistName", item.getArtistName());
				startActivity(i);
			}
		});
		return rootView;
	}
}
